<?php

namespace app\api\logic;
use GuzzleHttp\Client;
class HttpLogic
{
    public function request($method,$url,$data)
    {
        // 创建客户端请求
        $client = new Client();
        // 请求选项
        $options = [
            'headers' => [
                'Content-Type' => 'application/json',
            ],
            'verify' => false,
//            'json' => ['code' => $code],
//            'query' => ['access_token' => $this->accessToken()],

        ];

        $options = array_merge($options,$data);
        $response = $client->request($method,$url,$options);
        $body = $response->getBody();
        $stringBody = (string) $body;
        return json_decode($stringBody,true);
    }

}